package com.football.springboot.service.impl;

import com.football.springboot.entity.League;
import com.football.springboot.entity.Player;
import com.football.springboot.entity.Team;
import com.football.springboot.entity.TeamAbility;
import com.football.springboot.mapper.LeagueTeamMapper;
import com.football.springboot.mapper.TeamMapper;
import com.football.springboot.service.ITeamService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 李越
 * @since 2023-02-18
 */
@Service
public class TeamServiceImpl extends ServiceImpl<TeamMapper, Team> implements ITeamService {

    @Resource
    LeagueTeamMapper leagueTeamMapper;

    @Resource
    TeamMapper teamMapper;


    //查看球队参加的联赛id
    @Override
    public List<Integer> getLeagueTeam(Integer teamId) {
        return leagueTeamMapper.selectByTeamId(teamId);
    }

    //查看球队参加的联赛
    @Override
    public List<League> getLeagueByTeamId(Integer teamId) {
        List<League> leaguelist=teamMapper.findLeaguesByTeamId(teamId);
        return leaguelist;
    }

    @Override
    public Integer modifyTeamAbility(TeamAbility teamAbility) {
        return teamMapper.modifyTeamAbility(teamAbility);
    }

    //查看球员能力
    @Override
    public TeamAbility getTeamAbility(Integer teamId) {
        return teamMapper.getTeamAbility(teamId);
    }


    //查看球员阵容
    @Override
    public List<Player> getTeamPlayers(Integer teamId) {
        return teamMapper.findPlayersByTeamId(teamId);
    }


}
